package org.angelica.aliyun.entity;

/**
 * 阿里云临时凭证的角色对象
 * @author aizhimin
 */
public class StsRole {

    /**
     * 指定角色的全局资源描述符
     */
    private String roleArn;
    /**
     * 用户自定义参数。此参数用来区分不同的Token，可用于用户级别的访问审计。
     */
    private String roleSessionName;
    /**
     * 授权策略
     */
    private String policy;

    public String getRoleArn() {
        return roleArn;
    }

    public void setRoleArn(String roleArn) {
        this.roleArn = roleArn;
    }

    public String getRoleSessionName() {
        return roleSessionName;
    }

    public void setRoleSessionName(String roleSessionName) {
        this.roleSessionName = roleSessionName;
    }

    public String getPolicy() {
        return policy;
    }

    public void setPolicy(String policy) {
        this.policy = policy;
    }


    /**
     * 表格存储管理角色信息：来自阿里云访问控制后台
     * @return
     */
    public static StsRole getTablestoreManageRole(){
        StsRole stsRole = new StsRole();
        stsRole.setRoleArn("acs:ram::1042925693791173:role/tablestore-manage");
        stsRole.setRoleSessionName("tablestore-manage");
        stsRole.setPolicy("{\n" +
                "  \"Version\": \"1\",\n" +
                "  \"Statement\": [\n" +
                "    {\n" +
                "      \"Action\": \"ots:*\",\n" +
                "      \"Resource\": \"*\",\n" +
                "      \"Effect\": \"Allow\"\n" +
                "    }\n" +
                "  ]\n" +
                "}");
        return stsRole;
    }

    /**
     * 对象存储管理角色信息：来自阿里云访问控制后台
     * @return
     */
    public static StsRole getOssManageRole(){
        StsRole stsRole = new StsRole();
        stsRole.setRoleArn("acs:ram::1042925693791173:role/oss-manage");
        stsRole.setRoleSessionName("oss-manage");
        stsRole.setPolicy("{\n" +
                "  \"Statement\": [\n" +
                "    {\n" +
                "      \"Action\": \"oss:*\",\n" +
                "      \"Effect\": \"Allow\",\n" +
                "      \"Resource\": \"*\"\n" +
                "    }\n" +
                "  ],\n" +
                "  \"Version\": \"1\"\n" +
                "}");
        return stsRole;
    }

    /**
     * 智能媒体管理角色信息：来自阿里云访问控制后台
     * @return
     */
    public static StsRole getImmManageRole(){
        StsRole stsRole = new StsRole();
        stsRole.setRoleArn("acs:ram::1042925693791173:role/imm-manage");
        stsRole.setRoleSessionName("imm-manage");
        stsRole.setPolicy("{\n" +
                "  \"Statement\": [\n" +
                "    {\n" +
                "      \"Action\": \"imm:*\",\n" +
                "      \"Effect\": \"Allow\",\n" +
                "      \"Resource\": \"*\"\n" +
                "    }\n" +
                "  ],\n" +
                "  \"Version\": \"1\"\n" +
                "}");
        return stsRole;
    }

    /**
     * 日志服务管理角色信息：来自阿里云访问控制后台
     * @return
     */
    public static StsRole getLogManageRole(){
        StsRole stsRole = new StsRole();
        stsRole.setRoleArn("acs:ram::1042925693791173:role/log-manage");
        stsRole.setRoleSessionName("log-manage");
        stsRole.setPolicy("{\n" +
                "  \"Statement\": [\n" +
                "    {\n" +
                "      \"Action\": \"log:*\",\n" +
                "      \"Effect\": \"Allow\",\n" +
                "      \"Resource\": \"*\"\n" +
                "    }\n" +
                "  ],\n" +
                "  \"Version\": \"1\"\n" +
                "}");
        return stsRole;
    }

    /**
     * 短信服务管理角色信息：来自阿里云访问控制后台
     * @return
     */
    public static StsRole getSmsManageRole(){
        StsRole stsRole = new StsRole();
        stsRole.setRoleArn("acs:ram::1042925693791173:role/sms-manage");
        stsRole.setRoleSessionName("sms-manage");
        stsRole.setPolicy("{\n" +
                "  \"Statement\": [\n" +
                "    {\n" +
                "      \"Action\": \"dysms:*\",\n" +
                "      \"Effect\": \"Allow\",\n" +
                "      \"Resource\": \"*\"\n" +
                "    }\n" +
                "  ],\n" +
                "  \"Version\": \"1\"\n" +
                "}");
        return stsRole;
    }
}
